package com.autonavi.abs.generator.core.generator.application;

import com.autonavi.abs.generator.common.enumeration.TemplateEnum;
import com.autonavi.abs.generator.common.model.TableMeta;
import com.autonavi.abs.generator.core.generator.AbstractGenerator;
import com.autonavi.abs.generator.util.GenerateUtil;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author tianquan.ld
 * @version V1.0
 * <p>Description: pom 生成器</p>
 * @date 2020-08-10 17:25
 */
@Slf4j
@Component
public class EnvGenerator extends AbstractGenerator {

    private TemplateEnum templateType = TemplateEnum.Env;

    @Override
    public TemplateEnum getTemplateTypeEnum() {
        return templateType;
    }

    @Override
    public String getTemplateType() {
        return templateType.name();
    }

    @Override
    public void generate(TableMeta tableMeta) {

        try {
            Map<String, Object> dataMap = Maps.newHashMap();
            dataMap.put("appProperty", app);
            GenerateUtil.generateApp(freeMarkerConfigurer, templateType, dataMap);
        } catch (Exception e) {
            log.info("生成失败:{}", templateType.name());
            log.error(e.getMessage(), e);
        }
    }


}
